package com.gxwy.admin.controller;

import java.util.Map;

import javax.servlet.http.HttpSession;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import com.gxwy.admin.form.Admin;
import com.gxwy.admin.service.AdminServiceDao;


@Controller
@RequestMapping("admin")
public class AdminControl {
	@Autowired
	private AdminServiceDao contactService;
	
	@RequestMapping("/list")
	public String listContacts(Map<String, Object> map,HttpSession session) {
		map.put("contact", new Admin());
		return "entry";
	}

	@RequestMapping(value = "lists.mobile",method=RequestMethod.POST)
	  @ResponseBody String listContact(@ModelAttribute("contact")Admin contact,Map<String, Object> map,HttpSession session,String name,String password) {

		contact.setUsername(name);
		contact.setPassword(password);
		if(contactService.listContact(contact)==false){
			 return "true";
		}
		if(contactService.listContact(contact)==true){
			return "false";
		}
         return "0";
	}
	
}
